<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加用户</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/font-awesome/css/font-awesome.css}" rel="stylesheet">
    <link th:href="@{/css/plugins/iCheck/custom.css}" rel="stylesheet">
    <link th:href="@{/css/animate.css}" rel="stylesheet">
    <link th:href="@{/css/style.css}" rel="stylesheet">
    <link th:href="@{/css/custom.css}" rel="stylesheet">
</head>
<body class="gray-bg">

<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <div>
            <h1 class="logo-name"></h1>
        </div>
        <h3>添加新用户</h3>
        <form id="form-user" class="m-t" role="form" action="registerUser" method="post">
            <div class="form-group">
                <select id="usertype" class="form-control">
                    <option value="0">请选择用户类型</option>
                    <option value="0">普通用户</option>
                    <option value="1">渠道商</option>
                    <option value="2">渠道专员</option>
                    <option value="3">系统管理员</option>
                </select>
            </div>
            <div class="form-group">
                <select id="userlevel" class="form-control">
                    <option value="0">请选择用户等级</option>
                    <option value="0">普通用户</option>
                    <option value="1">vip用户</option>
                    <option value="2">vvip用户</option>
                </select>
            </div>
            <div class="form-group">
                <input autocomplete="off" type="text" id="telephone" name="telephone"
                       onKeyUp="value=value.replace(/[\W]/g,'')" class="form-control" placeholder="请输入手机号码" required>
            </div>
            <div class="form-group">
                <input autocomplete="off" type="text" id="username" name="username" class="form-control"
                       placeholder="请输入姓名" required>
            </div>
            <div class="form-group">
                <input autocomplete="off" type="password" id="password" name="password" class="form-control"
                       placeholder="请输入密码" required>
            </div>
            <div class="form-group">
                <select id="institution" class="form-control">
                    <option value="0">请选择机构全称</option>

                </select>
            </div>
            <div class="form-group">
                <input autocomplete="off" type="number" id="term_of_validity" name="term_of_validity" class="form-control"
                       placeholder="请输入有效期单位（天）"  required>
            </div>
            <button type="button" onclick="regist()" class="btn btn-primary block full-width m-b">注册</button>
            <a href="list" type="button" class="btn btn-white block full-width m-b">取消</a>
        </form>
    </div>
</div>
<div class="page-footer" style="position: absolute">
    © 2014-<span id="currentyear"></span> 南京涌亿思信息技术有限公司 苏ICP备17066984号-1
</div>
<!-- Mainly scripts -->
<script th:src="@{/js/jquery-2.1.1.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/slef/register.js}"></script>
<script th:inline="javascript" type="text/javascript">
    var ctxPath = /*[[@{/}]]*/'';
    $("#currentyear").text((new Date()).getFullYear());

    let data = [[${data}]];
    data = JSON.parse(data);

    if (data != null){
        for (var i = 0 ; i < data.length; i++){
            let organization = data[i];
            $("#institution").append('<option value="'+organization.organization_id+'">'+organization.organization_name+'</option>');
        }
    }


</script>

</body>

</html>
